package com.frxuexi.park2212.my

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.MyHistoryBean
import com.frxuexi.park2212.R
import com.frxuexi.park2212.databinding.ItemMyaskBinding

class MyHistoryAdapter:BaseQuickAdapter<MyHistoryBean,BaseViewHolder>(R.layout.item_myask) {
    lateinit var binding:ItemMyaskBinding
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemMyaskBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: MyHistoryBean) {
        binding=DataBindingUtil.getBinding<ItemMyaskBinding>(helper.itemView)!!
        binding.bean=item
        binding.historyStatus.apply {
            when(item.status){
                "待审批","已占用"->setTextColor(context.resources.getColor(R.color.orange))
                "已通过","空闲"->setTextColor(context.resources.getColor(R.color.green))
                "已拒绝","维护中"->setTextColor(context.resources.getColor(R.color.redfont))
            }
        }
    }
}